Skip to content

feat(server): serve only on a unix socket with OPENCODEX_UNIX_SOCKET, no TCP at all (AGE-6145) - #59

Open
agentradar-burst-controller[bot] wants to merge 4 commits into
gauge/ocx-2.100.12-readpath-locksfrom
gauge/ocx-unix-socket
Open

agentradar-burst-controller[bot] wants to merge 4 commits into
gauge/ocx-2.100.12-readpath-locksfrom
gauge/ocx-unix-socket

Conversation

@agentradar-burst-controller

Copy link
Copy Markdown

AGE-6145 (Fargate packs, Liza 12-05: unix sockets, not one task per company). With OPENCODEX_UNIX_SOCKET=<absolute path> set, ocx start serves only on that unix socket and opens no TCP listener, and sends nothing to a loopback TCP port: several companies' OCX processes will share one loopback in a pack task, each as its own Linux user, and OCX asks no key on loopback. Unset: behaviour unchanged. Nothing is released or used until the gateway pack ships (agentradar-gateway #20, held for qa-sec).

  • Bind: Bun.serve({ unix }) only, under umask 0177 (restored in a finally) plus chmod 0600; the parent folder must be a real directory owned by this uid with no group/other bits; a stale socket is replaced, a non-socket at the path is refused; an absolute path of at most 104 bytes.
  • No TCP: refuses to start beside unauthenticatedLoopbackListener, hub.managementIngress or a fixed claudeCode.intercept.port; the Claude intercept is refused at start and at runtime (unix_socket_only); no link listener; the CLI skips the liveness fence, port choice and TCP bind probes.
  • Self-calls: selfFetch (socket when set, plain fetch with the same arguments otherwise) for every call OCX makes to its own API (startup Claude state with the admin token, advisor, routed vision/describe, runtime/account/debug/observe/link status, gateway cache); directLocalHttpFetch connects by the socket, so stop/doctor/liveness probes do too. The health sentinel is skipped in unix mode.
  • Tests: tests/server/unix-socket-only.test.ts 11/11 (real server: socket only, no TCP, stale/non-socket/path rules, refusals, private parent, 0600 at bind, selfFetch, runtime intercept refusal); 11 related existing test files re-run, all pass. Files stay under the 2,000-line ratchet.

Cache/quota impact: none. No routing, account choice, retry or cache-key code is touched; only how the process listens and how it reaches itself.

HOLD: lands with the pack go-live (qa-sec on agentradar-gateway #20 first).

Code review receipt

Head: 737c5d8
Model: claude-sonnet-5-5
Findings: 5

  • src/server/index/claude-intercept-lifecycle.ts:90 runtime Claude intercept could open TCP via ensure() -> fixed in 737c5d8
  • src/cli/index.ts:753 startup Claude state fetch sent the admin token to the shared TCP label port -> fixed in 737c5d8
  • src/server/index/unix-socket-only.ts:36 advisor and routed-vision self-calls went to TCP -> fixed in 737c5d8
  • src/server/index/unix-socket-only.ts:65 socket created with the process umask and an unchecked parent folder -> fixed in 737c5d8
  • src/server/index/unix-socket-only.ts:79 a stale-socket removal does not probe for a live owner -> not a bug: the parent folder must be owned by this uid with no group/other bits, so another company's process can never reach or share the path, and the pack starter runs exactly one process per company per folder (one generation at a time)
    Verdict: clean

🤖 Generated with Claude Code

Gauge and others added 4 commits December 4, 2026 18:39
…(AGE-6145)

With the env set to an absolute path (at most 104 bytes), `ocx start` binds
only that unix socket (mode 0600; a stale socket is replaced, a non-socket
is refused) and opens no TCP listener: Claude intercept gets requested port
0, the hub link listener is not started, and the CLI skips the liveness
fence, port choice and TCP bind probes. Refused beside the unauthenticated
loopback listener or hub.managementIngress. Unset: unchanged.

Cache/quota impact: none; no routing, account, retry or cache-key code touched.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…it would open TCP) (AGE-6145)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…t (AGE-6145)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… and binds a private socket (AGE-6145)

Review findings: runtime Claude intercept start is refused (unix_socket_only) before any listener opens;
OCX's own HTTP calls (claude-code state, advisor, routed describe, CLI management calls, direct local
probes) go over the socket via selfFetch / directLocalHttpFetch; the socket is bound under umask 0177 in a
parent directory that must be a real, own-uid, 0700 directory. Unset env: unchanged.
Cache/quota impact: none; no routing, account, retry or cache-key code is touched.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants